# -*- encoding: utf-8 -*-
"""
File Name: launch
Description:
Author : 'lirui'
date: 2024/7/16
Contact: marjey_lee@163.com
Change Activity:
2024/7/16:
"""
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

_APP = FastAPI(
    title="Dedicated line monitor ",
    description="Dedicated line monitor ",
    version="1.0.1",
)
_MONITOR = MonitorService()
_MONITOR.start()
_APP.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=False,
    allow_methods=["*"],
    allow_headers=["*"],
)


@_APP.get("/health_check")
async def main():
    return _MONITOR.health_check


def _main():
    uvicorn.run(_APP, host="0.0.0.0", port=8080)


if __name__ == '__main__':
    _main()
